package mobile.game.core.support.random;

import java.util.Collections;

/**
 * @author g
 *
 * 伪随机数生成器，与StageRandomUtils的区别是，数据集是固定的且平均分布的数，用完一次全部打乱
 */
public class RandomFixUtils extends StageRandomUtils {
	
	public RandomFixUtils() {}
	
    public RandomFixUtils(int count) {
    	this.seekCur = 0;
    	this.seekCount = count;
    	
    	int interval = (int)div / count;
    	for (int i = 0; i < count; i++) {
    		seek.add(interval * i);
		}
    	
    	Collections.shuffle(seek);
    }
	
    @Override
    protected int index() {
        seekCur++;
        if (seekCur >= seekCount) {
        	Collections.shuffle(seek);
            seekCur = 0;
        }
        
        return seekCur;
    }
}
